home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-08 | 3.1 KB | 104 lines | [TEXT/ALFA] |
-
- # make alias list to pass to AEBuild
- proc makeAlis {name} {
- concat {[alis(«} [coerce TEXT $name -x alis] {»)]}
- }
-
-
-
- # Queued replies are passed through AEPrint and then to this routine.
- proc handleReply {rep} {
- global ALPHA lastReply
- # switchTo $ALPHA
- set lastReply $rep
- }
-
-
- # Return an object record specifying the desired think project file.
- proc fileObject {name} {
- join [concat {obj\{want:type('SFIL'), from:'null'(), form:'name', seld:“} [file tail $name] {”\}}] ""
- }
-
-
- proc sendOpenEvent {filler appname fname} {
- AEBuild $appname aevt odoc "----" [concat {[alis(«} [coerce TEXT $fname -x alis] {»)]}]
- }
-
-
- #================================================================================
- # Most of the routines below by Tom Pollard
- #================================================================================
-
- proc AEAbsPos {posName} {
- # (would like to be able to use 'first' and 'last' as well, but haven't yet
- # figured out the correct AEBuild syntax. "seld:abso('firs')" doesn't work.)
- if {$posName > 0} {
- return "form:indx, seld:long($posName)"
- } else {
- error "AEAbsPos: bad argument"
- }
- }
- proc AEName {name} {
- return "form:'name', seld:[curlyq $name]"
- }
- proc AEWinByName {name} {
- return "obj{want:type('cwin'), from:'null'(), [AEName $name] } "
- }
- proc AEWinByPos {absPos} {
- return "obj{want:type('cwin'), from:'null'(), [AEAbsPos $absPos] } "
- }
- proc AELineRange {absPos1 absPos2} {
- set lineObj1 "obj{ want:type('clin'), from:'ccnt'(), [AEAbsPos $absPos1] }"
- set lineObj2 "obj{ want:type('clin'), from:'ccnt'(), [AEAbsPos $absPos2] }"
- return "form:'rang', seld:rang{star:$lineObj1, stop:$lineObj2 } "
- }
-
- # Quit an application.
- proc sendQuitEvent {appname} {
- AEBuild $appname "aevt" "quit"
- }
-
- # Close one of an application's windows, designated by number.
- proc sendCloseWinNum {appname num} {
- AEBuild $appname "core" "clos" "----" [AEWinByPos $num]
- }
-
- # Close one of an application's windows, designated by name.
- proc sendCloseWinName {appname name} {
- AEBuild $appname "core" "clos" "----" [AEWinByName $name]
- }
-
- # Obtain the number of lines in one of an application's
- # windows, designated by name.
- proc sendCountLines {appname name} {
- set winObj [AEWinByName $name]
- set res [AEBuild -r $appname "core" "cnte" "----" $winObj kocl type('clin')]
- if {[regexp {:(.*)\}} $res allofit nlines]} {
- return $nlines
- } else {
- return 0
- }
- }
-
- # Get a selected range of lines from one of an application's
- # windows, designated by name. If $last is missing, then a single
- # line is returned; if both $first and $last are missing, then
- # the complete window contents are returned.
- proc sendGetText {appname name {first {missing}} {last {missing}}} {
- global ALPHA
- set winObj [AEWinByName $name]
- if {$first != "missing"} {
- if {$last != "missing"} {
- set rangDesc [AELineRange $first $last]
- } else {
- set rangDesc [AEAbsPos $first]
- }
- set objDesc "obj{want:type('clin'), from:$winObj, $rangDesc }"
- } else {
- set objDesc "obj{want:type('ctxt'), from:$winObj, form:'indx', seld:abso('all') }"
- }
- set res [AEBuild -r $appname "core" "getd" "----" $objDesc]
- if {![regexp {“.*”} $res text]} { set text {} }
- return [string trim $text {“”}]
- }
-